package com.itheima.day06.test2;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Test2 {
    public static void main(String[] args) {
        List<Student> list = new ArrayList<Student>();
        Student s1=new Student("张无忌","河北");
        Student s2=new Student("张三丰","河南");
        Student s3=new Student("赵敏","蒙古");
        Student s4=new Student("周芷若","四川");
        Collections.addAll(list,s1,s2,s3,s4);
        System.out.println(list);

        for (Student student : list) {
            if ("张三丰".equals(student.getName())) {
                student.setAddress("山东");
            }
        }
        System.out.println(list);
    }
}
